import { readAllAvatar, readVideo } from "../utils/read_file";
import  {BaseRepository,tableType}  from "../utils/insert_";

import Router from "koa-router";
import User from "./model/m_user";
import Video from "./model/m_video";

const get_static = new Router({ prefix: "/static" });

get_static.get("/avatar", async (ctx) => {
  ctx.status = 200;
  ctx.body = {
    code: 200,
    data: readAllAvatar(),
  };
});

get_static.get("/video",async (ctx) => {
ctx.status = 200;
ctx.body = {
    code: 200,
    data: readVideo(),
};
})

get_static.get("/test", async (ctx) => {
  // const instance=new BaseRepository<User>('users')
// const res= await instance.create(new User("test", "123456", ""));
  const instance=new BaseRepository<Video>('videos')
  try {
    // const res= await instance.create({
    //   v
    // });
    const res=""
     ctx.body = res;
  } catch (error) {
    ctx.body = error;
  }

 
});

export default get_static;
